#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
#else
#import "RCTBridgeModule.h"
#import "RCTEventEmitter.h"
#endif

//.h
#define PSSSingletonH(name) + (nonnull instancetype)shared##name;
//.m
#define PSSSingletonM(name,type) \
\
+ (instancetype)shared##name \
{ \
    static type *_instance = nil; \
    static dispatch_once_t onceToken; \
    dispatch_once(&onceToken, ^{ \
        _instance = [[super allocWithZone:NULL] init]; \
    }); \
    return _instance; \
} \
\
+ (instancetype)allocWithZone:(struct _NSZone *)zone \
{ \
    return [type shared##name]; \
} \
\
- (id)copyWithZone:(NSZone *)zone \
{ \
    return [type shared##name]; \
} \
- (id)mutableCopyWithZone:(nullable NSZone *)zone { \
    return [type shared##name]; \
}

@interface RNXG : RCTEventEmitter <RCTBridgeModule>
PSSSingletonH(Instance);
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
- (void)enableDebug:(BOOL)enabled;
- (void)setCredential:(NSString*)appID :(NSString*)accessKey;
- (void)registerPush;
- (void)unregisterPush;
@end
  
